package de.westranger.forex.trading.genetic.allel.operator;
import de.westranger.forex.trading.genetic.allel.Node;

public final class LogicalOperator implements Node{

	private static final long serialVersionUID = -4096105027260046324L;
	private Node root;
	private Node rightChild;
	private Node leftChild;
	private LogicalOperatorType optType;

	public LogicalOperator(final Node root,final Node rightChild, final Node leftChild,
			final LogicalOperatorType optType) {
		this.root = root;
		this.rightChild = rightChild;
		this.leftChild = leftChild;
		this.optType = optType;
	}

	@Override
	public Node getRoot() {
		return this.root;
	}
	
	@Override
	public int getValue() {
		return this.optType.getValue();
	}

	@Override
	public Node getRightChild() {
		return this.rightChild;
	}

	@Override
	public Node getLeftChild() {
		return this.leftChild;
	}

	@Override
	public void setRightChild(final Node rightChild) {
		this.rightChild = rightChild;
	}

	@Override
	public void setLeftChild(final Node leftChild) {
		this.leftChild = leftChild;
	}
	
	@Override
	public void setRoot(final Node root) {
		this.root = root;
	}
	
	@Override
	public Node clone(){
		return new LogicalOperator(null,null,null,this.optType);
	}
	
	public void setEnum(final LogicalOperatorType type){
		this.optType = type;
	}
}
